package test1230pm;

public class Test04 {
    public static void main(String[] args) {
        // (4)设计一个学生类和学校类
        // 场景：学生王五在大连科技上学、学生赵六在大连大学上学
        // 要求：根据需求创建学生和学校对象、并能表示出学生和学校之间的关联关系、打印学生以及所在学校的信息
        School keji = new School("大连科技","没啥技术含量的学校");
        School dalian = new School("大连大学","很牛掰的学校");
        Student wangwu = new Student("王五",keji);
        Student zhaoliu = new Student("赵六",dalian);
        System.out.println(wangwu);
        System.out.println(zhaoliu);
    }

}
class School{
    String schoolName;
    String schoolMessage;

    public School() {
    }

    public School(String schoolName, String schoolMessage) {
        this.schoolName = schoolName;
        this.schoolMessage = schoolMessage;
    }

    public String getSchoolName() {
        return schoolName;
    }

    public void setSchoolName(String schoolName) {
        this.schoolName = schoolName;
    }

    public String getSchoolMessage() {
        return schoolMessage;
    }

    public void setSchoolMessage(String schoolMessage) {
        this.schoolMessage = schoolMessage;
    }

    @Override
    public String toString() {
        return "School{" +
                "schoolName='" + schoolName + '\'' +
                ", schoolMessage='" + schoolMessage + '\'' +
                '}';
    }
}
class Student{
    String studentName;
    School school;

    public Student() {
    }

    public Student(String studentName, School school) {
        this.studentName = studentName;
        this.school = school;
    }

    public String getStudentName() {
        return studentName;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    public School getSchool() {
        return school;
    }

    public void setSchool(School school) {
        this.school = school;
    }

    @Override
    public String toString() {
        return "Student{" +
                "studentName='" + studentName + '\'' +
                ", school=" + school +
                '}';
    }
}
